<template>
	<el-input
		v-model="dataValue"
		:placeholder="placeholder"
		:type="type"
		:showPassword="type == 'password'"
		:readonly="item.readonly"
		:disabled="disabled"
		@input="valueChange"
		:autocomplete="type == 'password' ? 'new-password' : 'off'"
	></el-input>
</template>
<script type="text/javascript">
import stringMixin from './stringMixin'
import { bounceFun } from '@/utils'
export default {
	name: 'xh-input', // 新建 input
	mixins: [stringMixin],
	inject: {
		createFields: {
			default: null
		},
		XhForm: {
			default: null
		}
	},
	computed: {
		form() {
			return this.XhForm || this.createFields
		},
		type() {
			if (
				this.item &&
				['password', 'number', 'textarea'].includes(
					this.item.data && this.item.data.formType
				)
			) {
				return this.item.data.formType
			} else {
				return 'text'
			}
		},
		placeholder() {
			var { placeholder } = this.item || {}
			return placeholder || '请输入'
		}
	},
	mounted() {
		// this.$bus.$on('auto-fill', ({ dominate, value }) => {
		// 	if (dominate == this.item.key) {
		// 		this.valueChange(value)
		// 	}
		// })
	}
}
</script>
<style lang="scss" scoped>
.el-input {
	display: block;
}
</style>
